/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package requeteur;

import java.util.ArrayList;
import java.util.Collections;

/**
 *
 * @author Nargisse
 */
public class ResultatCollection {
    
    private ArrayList<Resultat> listResult;
    
    public ResultatCollection(){
        this.listResult = new ArrayList<Resultat>();
    }
    
    public void addResult(Resultat r){
        this.listResult.add(r);
    }
    
    public ArrayList<Resultat> getListResult(){
        return this.listResult;
    }
    
    public ArrayList<Double> sortResult(ArrayList<Resultat> r){
        ArrayList<Double> listScore = new ArrayList<Double>();
        for(Resultat res : r){
            listScore.add(res.getScrore());
        }
        Collections.sort(listScore);
        Collections.reverse(listScore);
        return listScore;
        /*ArrayList<Integer> test = new ArrayList<Integer>();
        test.add(2);
        test.add(9);
        test.add(8);
        test.add(1);
        //sort ascending
        System.out.println("1- listScore"+test);
        Collections.sort(test);
        System.out.println("2 - listScore"+test);
        Collections.reverse(test);
        System.out.println("3 - listScore"+test);*/
        
        
    }
}
